#include <stdio.h>
#include "hip/hip_runtime.h"
#include "B.hpp"


int main (void) {
  unsigned int i;
  hc::half *dg, hg[N];
  hc::half sum = 0.0;

  // foo<<<1, N>>>();
  hipLaunchKernelGGL(foo,dim3(1),dim3(N),0,0);

  if(hipGetSymbolAddress((void**)&dg, g)){
      printf("couldn't get the symbol addr\n");
      return 1;
  }
  if(hipMemcpy(hg, dg, N * sizeof(float), hipMemcpyDeviceToHost)){
      printf("couldn't memcpy\n");
      return 1;
  }

  for (i = 0; i < N; i++) {
    sum += hg[i];
  }
  if (sum == 36) {
    printf("PASSED\n");
  } else {
    printf("FAILED (%f)\n", sum);
  }

  return 0;
}